import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '../views/Home.vue';

Vue.use(VueRouter);

const routes = [{
        path: '/',
        redirect: '/home',
    },
    {
        path: '/home',
        component: Home,
        redirect: '/home/movies',
        children: [{
                path: 'movies',
                name: 'movies',
                meta: {
                    info: 1,
                },
                component: () =>
                    import ('@/views/home/movies/Movies.vue'),
            },
            {
                path: 'theaters',
                name: 'theaters',
                component: () =>
                    import ('@/views/home/theaters/Theaters.vue'),
            },
            {
                path: 'profile',
                name: 'profile',
                component: () =>
                    import ('@/views/home/profile/Profile.vue'),
            },
            {
                path: '/personal',
                name: 'personal',
                component: () =>
                    import ('@/views/home/profile/Personal.vue'),
            },
            {
                path: '/page',
                name: 'page',
                component: () =>
                    import ('@/views/home/movies/Page.vue'),
            },
        ],
    },
    {
        path: '/details',
        name: 'details',
        component: () =>
            import ('@/views/details/Details.vue'),
    },
    {
        path: '/citypicker',
        name: 'citypicker',
        component: () =>
            import ('@/views/citypicker/CityPicker.vue'),
    },

    {
        path: '/about',
        name: 'about',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/AboutView.vue'),
    },

];

const router = new VueRouter({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes,
});

export default router;